Thepal
|
Disciple
|
|
|
Reged: 06/21/03
|
Posts: 1359
|
Loc: Gold Coast, Australia
|
|
|
Hello boys and girls. Today we are experimenting with Targetted Global Scripts. As you can see, Targetted Script can access the NPC like a normal script *demonstrates with GetPos*
Ok, now let's see if they can access local variables.
*attempts*
Oh dear. It doesn't work. I don't suppose if anyone knows if Targetted scripts can access the variables in the objects local script? 'twould be most helpful (I'm trying to have multiple targetted scripts running on different NPCs at the same time, which means there need to be unique variables for each of them somewhere. Local ones would be easiest. I can do another way if I have to, but I'd prefer not).
Today's insanity was brought to you by...
-------------------- -==Thepal==-
Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php
Post Extras:
|
Thepal
|
Disciple
|
|
|
Reged: 06/21/03
|
Posts: 1359
|
Loc: Gold Coast, Australia
|
|
|
Oh... My other way of doing it won't work. >_< Ok... Umm.... Ahah! I have another other way. Nevermind ^_^
Still, I'd prefer to use local script variables
-------------------- -==Thepal==-
Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php
Post Extras:
|
GhanBuriGhan
|
Diviner
|
|
|
Reged: 10/06/01
|
Posts: 2977
|
Loc: Behind that tree!
|
|
|
Not sure how your problem is set up , but maybe you can set the values in the global script from the local ones:
set Global_script_name.variable to 1
You can use things like silent sounds and GetSoundPlaying to detect which script is running on your NPC.
-------------------- --//Forum Scholars guild\\--
MW Scripting for Dummies, Traveling Merchants, Combat Moves:
The Lys
World of Faces Mod
Post Extras:
|
Thepal
|
Disciple
|
|
|
Reged: 06/21/03
|
Posts: 1359
|
Loc: Gold Coast, Australia
|
|
|
Ack.
Ack.
Ack.
You just made me realise something. The global script will only run through once per frame. I was thinking it would run for each NPC.
Oh well... back to the drawing board.
Unless it will run for each NPC.... I hate testing >_<
-------------------- -==Thepal==-
Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php
Post Extras:
|
Thepal
|
Disciple
|
|
|
Reged: 06/21/03
|
Posts: 1359
|
Loc: Gold Coast, Australia
|
|
|
Grrr... only runs once. Can't even start and stop it for each NPC. Still only runs once. So much for a generic global script.
-------------------- -==Thepal==-
Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php
Post Extras:
|
ManaUser
|
Master
|
|
|
Reged: 06/01/00
|
Posts: 6095
|
Loc: Long Beach, CA, USA
|
|
|
No, you're right. Only one copy of a global script can run at a time.
Post Extras:
|
Thepal
|
Disciple
|
|
|
Reged: 06/21/03
|
Posts: 1359
|
Loc: Gold Coast, Australia
|
|
|
That's really disappointing. I was hoping to create a cooking (among other things) script, and all I would have to do is start it on someone and they would start cooking. Now I'll have to put the code in the person's individual script (along with all the other things they can do)
-------------------- -==Thepal==-
Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php
Post Extras:
|
|
|
You could just make clones of the global script like ArrilleCooking and MeldorCooking. I know it's a bit more bloated but it makes adding functionality to an NPC a lot more tidy. As long as you're sure to stop the global scripts when not needed it might be ok.
-------------------- New to the forums? Looking for something? Before asking, one of these might help...
Main Index|Search|My Home|Who's Online|FAQ|Logout|Mark All Read
Can you guess which?
Fashionable Merchants 1.0
Available at http://morrowind.matterofopinion.net/
Post Extras:
|
Thepal
|
Disciple
|
|
|
Reged: 06/21/03
|
Posts: 1359
|
Loc: Gold Coast, Australia
|
|
|
That's true. I think I will do that.
It's annoying that I still need seperate ones though. Oh well
-------------------- -==Thepal==-
Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php
Post Extras:
|
GhanBuriGhan
|
Diviner
|
|
|
Reged: 10/06/01
|
Posts: 2977
|
Loc: Behind that tree!
|
|
|
Will there ever be two such NPC that the player is close to at the same time? If not, you can just automatically stop the global script, e.g.when the player leaves the cell, or is a certain distance away. Then the global is available agin for the next cook the player encounters.
-------------------- --//Forum Scholars guild\\--
MW Scripting for Dummies, Traveling Merchants, Combat Moves:
The Lys
World of Faces Mod
Post Extras:
|
Thepal
|
Disciple
|
|
|
Reged: 06/21/03
|
Posts: 1359
|
Loc: Gold Coast, Australia
|
|
|
I want to be safe and assume there could be.
-------------------- -==Thepal==-
Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php
Post Extras:
|
GhanBuriGhan
|
Diviner
|
|
|
Reged: 10/06/01
|
Posts: 2977
|
Loc: Behind that tree!
|
|
|
You could still use something like my combat moves plugin with 3 or 4 copies of the global script (scripts a-d) for safety: it checks whether a) the NPC already has a script running b) if not whether the global script a-d are already running
Starts a targeted script that is currently not in use on the NPC (and stops it again based on distance). That is fairly safe, if you can estimate the maximum number of NPC's that you could have at the same time.
-------------------- --//Forum Scholars guild\\--
MW Scripting for Dummies, Traveling Merchants, Combat Moves:
The Lys
World of Faces Mod
Post Extras:
|
|
|
You see why people like GBG have my respect; they think up neat little workarounds and doges that I really like. It's the background in formal Philosophy - I love tricksy little loopholes . And it makes them good scripters.
-------------------- New to the forums? Looking for something? Before asking, one of these might help...
Main Index|Search|My Home|Who's Online|FAQ|Logout|Mark All Read
Can you guess which?
Fashionable Merchants 1.0
Available at http://morrowind.matterofopinion.net/
Post Extras:
|
|
|
Or...
Write the global script so that it does not care whether it runs every frame or not and make it self terminating each frame so the script can pick up from whichever state it is in and do the apropriate things in a single 'hit'. Then you can call this script on your target at any time and if it doesnt run on your target this frame try again next frame until it fires.
Now where to store the state while running the same script on multiple NPCs, how about all those unused stats, I dont think the NPC will mind if you boost his resistcorprus stat to whichever value you like. And it works in savegames too pretty much.
Post Extras:
|
Thepal
|
Disciple
|
|
|
Reged: 06/21/03
|
Posts: 1359
|
Loc: Gold Coast, Australia
|
|
|
Quote:
You could still use something like my combat moves plugin with 3 or 4 copies of the global script (scripts a-d) for safety: it checks whether a) the NPC already has a script running b) if not whether the global script a-d are already running
Starts a targeted script that is currently not in use on the NPC (and stops it again based on distance). That is fairly safe, if you can estimate the maximum number of NPC's that you could have at the same time.
Yeah, I thought of that. I think I'll just do individual scripts though. That will let me code in locations of things which will make it all easy. I need to stop thinking complex.
-------------------- -==Thepal==-
Creator of the Unofficial Patch. For info on that or my Ultima 9 remake or my Quest for Glory remakes go to: http://etherealsoftware.com.au/forum/index.php
Post Extras:
|